<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title></title>
<link href="/resources/css/common.css" rel="stylesheet" type="text/css" />
<link href="/resources/css/home.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="/resources/js/reference/jquery.js"></script>
<script type="text/javascript" src="/resources/js/reference/jquery.js"></script>
<script type="text/javascript" src="/resources/js/base/dialog.js"></script>
<script type="text/javascript" src="/resources/js/base/request.js"></script>
<script type="text/javascript" src="/resources/js/base/global.js"></script>
<script type="text/javascript" src="/resources/js/reference/jquery.fly.min.js"></script>
<style>
#fly-img{ right: 380px;  top: 10px;}
</style>
<script type="text/javascript">
function checkView(e,id){
	var url  = '/product/product/content.jhtml?flag=1&id='+id;
	create_iframe(url,e);
}
//查看公告
function check_view(url){
	var w = 800;
	var h = $(window).height();
	var $dialog = $.dialog({
		title:'${message("查看公告")}',
		width:1000,
		height:h,
		content: "<iframe src='"+url+"' width='100%'  height='"+(h-50)+"px'><\/iframe>",
		ok: null,
		cancel: null
	});
	$dialog.find(".dialogContent").css("height",h+"px");
	$dialog.css("top",0+"px").css("max-height",h+"px");
	

}

function search(e){
	var keyword = $("#keyword").val();
	var url = '/product/product/list_pc.jhtml?keyword='+keyword;
	$(e).attr("data-src" , url);
	top.open_new_tab(e);
}

$().ready(function() {
// 	initCount();
});

/**待办*/
function initCount(){
	var param = '';
	var n = 0;
	$(".user-item").each(function(index){
		var $this = $(this);
		var $a = $this.find("a");
		if($a.length>0){
				$a.each(function(){
					var $item = $(this);
					var _id = $item.attr("_id");
					if(n>0)param+="&";
					param+="ids="+_id;
					n++;
				})
		}
		
	});
	if(param!=''){
		ajaxSubmit('',{
			method:'post',
			url:'count_statistics.jhtml',
			data : param,
			async: false,
			callback: function(resultMsg) {
				var data = resultMsg.objx;
				$(".user-item").each(function(index){
					var $this = $(this);
					var $a = $this.find("a");
					$a.each(function(){
						var $item = $(this);
						var _id = $item.attr("_id");
						var _isMoney = $item.attr("_isMoney");
						var str = '';
						if(_isMoney=='1'){
							str ='<em>￥</em>';
						}
						str+= data[_id];
						$item.find("b").html(str);
					})
				});
			}
		})
	}
	
}

//添加购物车
function addCart(t, e, id, i){
	if(e.stopPropagation)e.stopPropagation();
	else e.cancelBubble=true;
	var storeId = $("#storeId").val();
	ajaxSubmit(t,{
		method:'post',
		url: "${base}/b2b/cart/add.jhtml",
		data: {productId: id,quantity:1,storeId:storeId,flag:1},
		callback: function(resultMsg) {
			btnFly(t,e);
			$(".cartNum").text(resultMsg.objx);
		}
	})
}

function btnFly(t,event){
	var addcar = $(t);
	var offset = $("#fly-img").offset();
	var img = addcar.closest('li').find('img').attr('src');
	var flyer = $('<img class="u-flyer" src="'+img+'">');
	flyer.fly({
		start: {
			left: event.pageX,
			top: event.pageY
		},
		end: {
			left: offset.left+10,
			top: offset.top+10,
			width: 0,
			height: 0
		},
		onEnd: function(){
			//$("#msg").show().animate({width: '250px'}, 200).fadeOut(1000);
			//addcar.css("cursor","default").unbind('click');
			addcar.css("display","none");
			this.destory();
		}
	});


}

</script>
</head>
<body >
<div class="index-box">
	<div id="fly-img"></div><!-- 这是飞动效果定点  不要删 -->
    	<div class="user-item" style="width:73%;float:right">
	        <div class="l">
	        	<i class="u-02" style="background:url(/resources/images/home-title-left.png) no-repeat center;background-size: 45px;margin-top:35px;"></i>
	        </div>
	        <div class="r">
	            <div class="data-info">
	            	<a href="javascript:void(0);" >
<!-- 		                <b id="count-number" data-to="0" data-speed="1500" class="timer"> -->
		                <b>
		                ${countCar}</b>
		                <p class="icon"><img src="/resources/images/car-01.png" />车辆总数</p>
	                </a>
	                <a href="javascript:void(0);" >
<!-- 		                <b id="count-number" data-to="0" data-speed="1500" class="timer"> -->
						<b>
		                ${countElock}</b>
		                <p class="icon"><img src="/resources/images/lock-01.png" />锁总数</p>
	                </a>
	                <a href="javascript:void(0);" >
<!-- 		                <b id="count-number" data-to="0" data-speed="1500" class="timer"> -->
						<b>
		                ${countTerminal }</b>
		                <p class="icon"><img src="/resources/images/key-01.png" />钥匙总数</p>
	                </a>
	            </div>
	        </div>
	    </div>
        <div class="box-right">
        	<div class="user-info">
            	<div class="pic pointer" onclick="create_iframe('/member/edit.jhtml?id=${member.id}&flag=1')"><img src="[#if member.imageName??]${member.imageName}"[#else]/resources/images/elock-logo.jpg" style="margin-top:15px"[/#if] /></div>
                <div class="txt">
                	<p class="user-ico">${member.name}</p>
            		<div style="display:inline-block;width:100%">
            			<div style="height:30px;line-height:30px">
            				<input type="hidden" class="text storeId" id="storeId" value="${store.id}"/>
            				所属机构
            			</div>
            			<b style="font-size: 18px;display: block;font-weight: 400;color: #fd7960;">${saleOrg.name}</b>
            		</div>
                </div>
            </div>
            <div class="news-wrap">
            	<div class="n-tab"><a href="#" class="on">公告</a>[#--<a href="#">消息</a>--]</div>
                <div class="n-cont">
                	<ul>
                		[#list systemNotices as systemNotice]
                    	<li><a href="javascript:void(0);" onclick="check_view('/homepage/systemNotice/notice.jhtml?id=${systemNotice.id}')" class="red">${systemNotice.title}</a></li>
                    	[/#list]
                    </ul>
                </div>
            </div>
            <div class="i-title">快捷通道</div>
            <div class="shortcut">
               		<a href="javascript:void(0);"  onclick="top.open_new_tab(this)" data-id="16"  data-src="/realtime_monitor/list_tb.jhtml" data-name="实时监控"><img src="/resources/images/realtime-32x32.png" />实时监控</a>
               		<a href="javascript:void(0);"  onclick="top.open_new_tab(this)" data-id="17"  data-src="/car_monitor/list_tb.jhtml" data-name="车辆数据"><img src="/resources/images/car-32x32.png" />车辆数据</a>
               		<a href="javascript:void(0);"  onclick="top.open_new_tab(this)" data-id="18"  data-src="/terminal_monitor/list_tb.jhtml" data-name="钥匙数据"><img src="/resources/images/key-32x32.png" />钥匙数据</a>
               		<a href="javascript:void(0);"  onclick="top.open_new_tab(this)" data-id="19"  data-src="/message_event_monitor/list_tb.jhtml" data-name="事件数据"><img src="/resources/images/shijian-32x32.png" />事件数据</a>
            </div>
        </div>
</div>
</body>
</html>